package com.tecdam.payment.samples;

import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Form;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.Displayable;

/**
 * @author rafaelrocha
 */
public class JSRTest extends MIDlet implements Runnable, CommandListener{
    Form form;
    Thread thread;
    Command c=new Command("Exit",Command.EXIT,0);
    public JSRTest()
    {
        Display.getDisplay(this).setCurrent(form=new Form("JSR Test"));
        form.addCommand(c);
        form.setCommandListener(this);
        (thread=new Thread(this)).start();
    }
    protected void destroyApp(boolean u){
        super.notifyDestroyed();
    }
    protected void pauseApp() {
    }
    protected void startApp(){
    }
    public void run() {
        checkJSR("MIDP2.0","javax.microedition.lcdui.game.GameCanvas");
        checkJSR("CLDC1.1","java.lang.Float");
        checkJSR("MMAPI","javax.microedition.media.Player");
        checkJSR("WMAPI","javax.wireless.messaging.Message");
        checkJSR("JSR75","javax.microedition.io.file.FileConnection");
        checkJSR("JSR082","javax.bluetooth.UUID");
        checkJSR("JSR179","javax.microedition.location.Location");
        checkJSR("JSR180","javax.microedition.sip.SipConnection");
        checkJSR("JSR184","javax.microedition.m3g.Mesh");
        checkJSR("JSR211","javax.microedition.content.Registry");
        checkJSR("JSR226","javax.microedition.m2g.SVGImage");
        checkJSR("JSR229","javax.microedition.payment.TransactionRecord");
        checkJSR("JSR234","javax.microedition.amms.Module");
        checkJSR("JSR238","javax.microedition.global.Formatter");
        checkJSR("JSR239","javax.microedition.khronos.egl.EGL");
    }
    private void checkJSR(String jsr,String className)
    {
        try {
            Class.forName(className);
            form.append(jsr+" Supporte\n");
        } catch (ClassNotFoundException e) {
            form.append(jsr+" Not Supporteds\n");
        }
    }
    public void commandAction(Command cmd, Displayable disp) {
        this.destroyApp(false);
    }
}  